#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @author: zzll0909
# @file: 2.py
# @time: 2021/6/21
# @software: PyCharm

def delete_duplicates_1(li: list) -> list:
    return list(set(li))


def delete_duplicates_2(li: list) -> list:
    result_list = list()
    for i in li:
        if len(result_list) == 0:
            result_list.append(i)
        else:
            if i not in result_list:
                result_list.append(i)
    return result_list

def delete_duplicates_3(li: list) -> list:
    result_list = list()
    li.sort()
    result_list.append(li[0])
    for i in range(1,len(li)):
        if li[i]!=li[i-1]:
            result_list.append(li[i])
    return result_list


if __name__ == "__main__":
    ip_list = [
        '221.228.143.52',
        '221.228.143.52',
        '221.228.143.52',
        '192.168.1.1',
        '127.0.0.1',
        '8.8.8.8',
        '127.0.0.1',
        '192.168.0.1',
    ]
    result_1 = delete_duplicates_1(ip_list)
    print(result_1)
    result_2 = delete_duplicates_2(ip_list)
    print(result_2)
    result_3 = delete_duplicates_3(ip_list)
    print(result_3)
    pass
